﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections;
namespace mealplanner.control
{
    public class Diet : Meal
    {
        private int high_level;
        private int low_level;
        void sethigh_level(int high)
        {
            high_level = high;
        }
        int gethigh_level()
        {
            return high_level;
        }
        void setlow_level(int low)
        {
            low_level = low;
        }
        int getlow_level()
        {
            return low_level;
        }

        /// <summary>
        /// meals For Specific Calories Range.
        /// </summary>
        /// <param name="min">minimum number of calories</param>
        /// <param name="max"> maximum number of array calories</param>
        /// <returns>Array list of meals For Specific Calories Range </returns>
        public ArrayList MealsForSpecificCaloriesRange(double min, double max)
        {
            if (max > min)
            {
                ArrayList mealsList = new ArrayList();
                mealsList = DisplayAllMealsDietStyle(max, min);
                return mealsList;
            }
            else {
                ArrayList List = new ArrayList();
                List.Add(0);
                return List;
            }
        }
        /// <summary>
        /// Gets the meals that has calories less than or equal to specified calories by user
        /// </summary>
        /// <param name="type">the type of meal given</param>
        /// <param name="calories"> calories that was specfied by the user</param>
        /// <returns>All Meals within the range of specified calory</returns>
        ArrayList DisplayAllMealsDietStyle(double maxCalories, double minCalories)
        {
            string type;
            ArrayList AllMeals = new ArrayList();
            ArrayList MealsDietStyle = new ArrayList();

            type = "Dish";
            AllMeals = ShowMeals(type);
            type = "Juice";
            AllMeals.AddRange(ShowMeals(type));
            type = "Salad";
            AllMeals.AddRange(ShowMeals(type));
            type = "Soup";
            AllMeals.AddRange(ShowMeals(type));
            type = "Sandwich";
            AllMeals.AddRange(ShowMeals(type));

            for (int i = 0; i < AllMeals.Count; i++)
            {
                if ((CaluclateCalories(AllMeals[i].ToString()) <= maxCalories) && (CaluclateCalories(AllMeals[i].ToString()) >= minCalories))
                {
                    MealsDietStyle.Add(AllMeals[i].ToString());
                }
            }
            return MealsDietStyle;
        }
    }
}
